package com.globallogic.dailyplanner.jsfbeans;

import java.io.Serializable;
import java.util.List;

import javax.faces.bean.ManagedBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.globallogic.dailyplanner.dto.User;
import com.globallogic.dailyplanner.service.UserService;

@Controller
@ManagedBean
public class UserBean implements Serializable{
	
	private static final long serialVersionUID = -2510917374150345059L;
	
	@Autowired
	private UserService userService;
	
	private String name;
	private String password;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public UserService getUserService() {
		return userService;
	}

	public void setUserService(UserService userService) {
		this.userService = userService;
	}

	public List<User> getUsers(){
		return userService.getAll();
	}
	
	public void activateUser(int userId){
		userService.activate(userId);
	}
	
	public void killUser(int userId){
		userService.kill(userId);
	}
}
